package com.xinxin.base.controller;

import com.xinxin.base.holder.ThreadLocalContextHolder;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author ys
 * @date 2021/4/26
 */
public abstract class BaseController {

    @Autowired
    protected HttpServletRequest request;
    @Autowired
    protected HttpServletResponse response;

    @Resource
    private ThreadLocalContextHolder userContextHolder;

    protected <T> T getCurrentUser() {
        return (T) userContextHolder.getContext();
    }
}
